$(function () {
    setHomeData();
});
function setHomeData() {
    let data = JSON.parse(commonData());
    $(".cpy_content>div:first-child").html(data.company.intro);
    let result = myAjax('/product', 'post', {"product_type": 0, "page": 1}, 'json');
    // console.log(JSON.stringify(result));
    $("#photo").html("");
    for (let i=0;i<=2;i++){
        $("#photo").append("<img onclick='redirectProductDetails("+i+","+JSON.stringify(result)+")' src='"+result.products[i].photo+"' height='100%' width='100%'/>");
    }
}
function redirectProductDetails(i,result) {
    // console.log(result);
    sessionStorage.setItem("productData",JSON.stringify(result));
    sessionStorage.setItem("pdti", i);
    window.location.href = "/html/front/productdetails.html";
}